package com.slaffka.action;

import org.jboss.seam.international.status.Messages;
import org.jboss.solder.logging.Logger;

import javax.inject.Inject;
import java.io.Serializable;

/**
 * Created with IntelliJ IDEA.
 * User: slaffka
 * Date: 01.12.12
 * Time: 18:54
 * To change this template use File | Settings | File Templates.
 */
public class AbstractAction implements Serializable {

    @Inject
    private Logger log;
    @Inject
    private Messages messages;

    protected String msg = "";
    private Boolean hasError = Boolean.FALSE;

    public Boolean getHasError() {
        return hasError;
    }

    protected void printInfo() {
        hasError = Boolean.FALSE;
        log.info(msg);
        messages.info(msg);
    }

    protected void printError(Exception e) {
        hasError = Boolean.TRUE;
        log.error(msg);
        messages.error(msg);
        e.printStackTrace();
    }
}
